Spot-On
spot-on-rss.h
1 /*
2 ** Copyright (c) 2011 - 10^10^10, Alexis Megas.
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 ** 1. Redistributions of source code must retain the above copyright
9 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
13 ** 3. The name of the author may not be used to endorse or promote products
14 ** derived from Spot-On without specific prior written permission.
15 **
16 ** SPOT-ON IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 ** SPOT-ON, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef _spoton_rss_h_
29 #define _spoton_rss_h_
30 
31 #include <QAtomicInt>
32 #include <QFuture>
33 #include <QNetworkAccessManager>
34 #include <QNetworkReply>
35 #include <QPointer>
36 #include <QTimer>
37 
38 #include "ui_spot-on-rss.h"
39 
40 class spoton;
41 class spoton_crypt;
42 
43 class spoton_rss: public QMainWindow
44 {
45  Q_OBJECT
46 
47  public:
48  spoton_rss(spoton *parent);
49  ~spoton_rss();
50  void center(QWidget *parent);
51  void deactivate(void);
52  void prepareAfterAuthentication(void);
53  void show(void);
54 
55  private:
56  QAtomicInt m_cancelImport;
57  QByteArray m_feedDownloadContent;
58  QFuture<void> m_importFuture;
59  QFuture<void> m_parseXmlFuture;
60  QNetworkAccessManager m_contentNetworkAccessManager;
61  QNetworkAccessManager m_feedNetworkAccessManager;
62  QPalette m_originalFindPalette;
63  QPointer<QAction> m_scheduleAction;
64  QString removeSpecialTags(const QString &text);
65  QTimer m_downloadContentTimer;
66  QTimer m_downloadTimer;
67  QTimer m_importTimer;
68  QTimer m_statisticsTimer;
69  Ui_spoton_rss m_ui;
70  int m_currentFeedRow;
71  spoton *m_parent;
72  bool importUrl(const QList<QVariant> &list, const int maximumKeywords);
73  spoton_crypt *urlCommonCrypt(void) const;
74  void closeEvent(QCloseEvent *event);
75  void hideUrl(const QUrl &url, const bool state);
76  void import(const int maximumKeywords);
77  void parseXmlContent(const QByteArray &data, const QUrl &url);
78  void populateFeeds(void);
79  void prepareDatabases(void);
80  void saveFeedData(const QString &description,
81  const QString &link,
82  const QString &title);
83  void saveFeedImage(const QByteArray &data, const QString &link);
84  void saveFeedLink(const QString &description,
85  const QString &link,
86  const QString &publicationDate,
87  const QString &title,
88  const QUrl &url);
89 
90  private slots:
91  void slotActivate(bool state);
92  void slotActivateImport(bool state);
93  void slotAddFeed(void);
94  void slotContentReplyFinished(void);
95  void slotCopyFeedLink(void);
96  void slotCopyFeedLinks(void);
97  void slotDeleteAllFeeds(void);
98  void slotDeleteFeed(void);
99  void slotDownloadContent(void);
100  void slotDownloadFeedImage(const QUrl &imageUrl, const QUrl &url);
101  void slotDownloadIntervalChanged(double value);
102  void slotDownloadTimeout(void);
103  void slotFeedImageReplyFinished(void);
104  void slotFeedReplyFinished(void);
105  void slotFeedReplyReadyRead(void);
106  void slotFind(void);
107  void slotFindInitialize(void);
108  void slotImport(void);
109  void slotLogError(const QString &error);
110  void slotMaximumKeywordsChanged(int value);
111  void slotPopulateFeeds(void);
112  void slotProxyClicked(bool state);
113  void slotPurge(void);
114  void slotPurgeDaysChanged(int value);
115  void slotRecordNotices(bool state);
116  void slotRefreshTimeline(void);
117  void slotRemoveMalformed(void);
118  void slotReplyError(QNetworkReply::NetworkError code);
119  void slotSaveProxy(void);
120  void slotScheduleFeedUpdate(void);
121  void slotShowContextMenu(const QPoint &point);
122  void slotShowMenu(void);
123  void slotStatisticsTimeout(void);
124  void slotTabChanged(int index);
125  void slotTimeOrderBy(bool state);
126  void slotTimelineShowOption(bool state);
127  void slotToggleState(void);
128  void slotUrlClicked(const QUrl &url);
129 
130  signals:
131  void downloadFeedImage(const QUrl &imageUrl, const QUrl &url);
132  void logError(const QString &error);
133 };
134 
135 #endif
spoton
Definition: spot-on.h:407
spoton_rss
Definition: spot-on-rss.h:43
spoton_crypt
Definition: spot-on-crypt.h:64